﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Wordprocessing;
using DocumentFormat.OpenXml.Packaging;

namespace Docx2Epub.Docx
{
    public class DocDocument
    {
        private string path;
        private List<OpenXmlElement> paragraphs;

        public DocDocument(string path)
        {
            this.path = path;
            paragraphs = new List<OpenXmlElement>();
        }

        public IEnumerable<DocElement> Elements { set; get; }

        public void Analyze()
        {
            using (var doc = WordprocessingDocument.Open(path, false))
            {
                var body = doc.MainDocumentPart.Document.Body;
                var traverser = new ElementTraverser(body);
                this.Elements = traverser.TraverseDocTree();
            }
        }


    }
}
